Skip to content

Decouple display and recording/inference FPS#80

Draft
C-Achard wants to merge 5 commits into
cy/gentl-trigger-uifrom
cy/limit-display-fps
Draft

Decouple display and recording/inference FPS#80
C-Achard wants to merge 5 commits into
cy/gentl-trigger-uifrom
cy/limit-display-fps

Conversation

@C-Achard
Copy link
Copy Markdown
Contributor

Motivation

This pull request introduces several improvements to multi-camera handling, frame rate configuration, and debugging/telemetry in the codebase.
The main changes include

  • Decoupled high-frequency frame processing from display updates in the GUI (set to 30 FPS)
    • Recording should now have more resources to follow requested FPS
    • Inference still uses only the latest unprocessed frame, making speed bottlenecked by inference only
    • GUI display is capped at 30 FPS now (configurable)
  • Enhancing telemetry for camera frame rates, and adding utility functions for robust GenTL node values extraction
    • Fixes the incorrect FPS reporting for GenTL

Automated summary

Multi-camera frame handling and GUI update throttling:

  • Separated high-frequency frame_ready signal (used for recording and inference) from the new display_ready signal (throttled to GUI_MAX_DISPLAY_FPS for efficient GUI updates) in MultiCameraController, with corresponding handler changes in main_window.py (_on_multi_frame_processing_ready and _on_multi_frame_display_ready). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Added GUI_MAX_DISPLAY_FPS global setting and related debug flags in config.py.
  • Updated signal connections and handler names in main_window.py to reflect the separation of processing and display paths. [1] [2] [3]

Camera frame rate configuration and telemetry improvements:

  • Improved frame rate configuration logic in gentl_backend.py to log before/after states, use more robust node selection, and set the actual FPS based on accepted values.
  • Enhanced telemetry reading to prioritize resulting frame rate nodes, fall back to requested rates, and persist more telemetry data (e.g., exposure, gain, throughput, pixel format) for debugging and GUI display.

Debugging and utility enhancements:

  • Added _debug_frame_rate_nodes for detailed logging of relevant GenICam node values, aiding in debugging frame rate issues. [1] [2]
  • Implemented utility methods _node_value, _node_float, and _node_str for robust, best-effort extraction of node values, reducing boilerplate and error handling throughout the code.

These changes collectively make the system more robust for high-performance multi-camera setups and improve the ability to debug and monitor camera settings and telemetry.

C-Achard added 4 commits May 29, 2026 13:45
Refactor _on_frame_captured to minimize time spent under _frame_lock and improve timing granularity. Introduces a frame_data local, renames timing labels (e.g. Multi.apply_transforms, Multi.store_latest, Multi.build_ordered, Multi.construct_frame_data), and moves frame_data construction inside measured blocks. The frame_ready emit is now performed outside the lock and guarded by a None check to avoid holding the lock during signal emission. Also small whitespace and cleanup changes.
Introduce a separate, throttled UI/display path for multi-camera frames. Add GUI_MAX_DISPLAY_FPS config and a new display_ready signal that is emitted at most at that rate, while frame_ready remains full-rate for recording/inference. Implement _should_emit_display_ready, wire the MultiCameraController to emit both signals, and reset throttling state when starting. Update the main window to handle processing and display paths via _on_multi_frame_processing_ready and _on_multi_frame_display_ready, and adjust tests accordingly. Also add GUI/debug timing config keys and a temporary timing-only early path in SingleCameraWorker (marked as FIXME).
Add helpers and telemetry to better read and debug GenTL/GenICam cameras.

- New debug helper _debug_frame_rate_nodes to log many common frame-rate/exposure/throughput nodes.
- Added robust node accessors: _node_value, _node_float, _node_str to safely read various GenICam node types and try multiple node names.
- Enhance frame-rate configuration to log before/after values when enabling rate control and when setting AcquisitionFrameRate/AcquisitionFrameRateAbs; record any accepted frame-rate as _actual_fps.
- After starting acquisition, attempt to read telemetry and run FPS debug logging; warn (but continue) if telemetry read fails.
- Improve _read_telemetry to prefer resulting frame-rate nodes over requested ones, and to populate actual_fps, actual_exposure, actual_gain and other useful properties (pixel format, throughput, resolution, etc.) into the settings namespace for GUI/debugging.

These changes make frame-rate/exposure behavior more observable and more tolerant across different camera implementations.
@C-Achard C-Achard self-assigned this May 29, 2026
@C-Achard C-Achard added enhancement New feature or request camera Related to cameras and camera backends labels May 29, 2026
@C-Achard C-Achard requested a review from Copilot May 29, 2026 15:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Decouples high-rate camera frame processing (recording/inference) from GUI display updates by introducing a separate, throttled display_ready signal capped at GUI_MAX_DISPLAY_FPS, and improves GenTL FPS configuration/telemetry with new node-reading helpers and debug logging.

Changes:

  • Add display_ready signal and _should_emit_display_ready() throttling in MultiCameraController; restructure _on_frame_captured timing sections.
  • Split _on_multi_frame_ready into _on_multi_frame_processing_ready (recording/inference) and _on_multi_frame_display_ready (GUI), and add GUI_MAX_DISPLAY_FPS plus debug-timing flags in config.py.
  • Improve GenTL backend: add _node_value/_node_float/_node_str helpers, _debug_frame_rate_nodes, expanded telemetry (resulting vs requested FPS, exposure, gain, throughput, pixel format), and richer FPS configuration logging.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
dlclivegui/config.py Adds GUI_MAX_DISPLAY_FPS and debug timing flags.
dlclivegui/services/multi_camera_controller.py Adds throttled display_ready signal and refactors frame handling/timing.
dlclivegui/gui/main_window.py Splits processing/display handlers and rewires multi-camera signal connections.
dlclivegui/cameras/backends/gentl_backend.py Adds node-reading helpers, FPS debug logging, and broader telemetry readback.
tests/gui/test_pose_overlay.py Updates test to use renamed _on_multi_frame_processing_ready handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dlclivegui/gui/main_window.py Outdated
Comment thread dlclivegui/config.py Outdated
Fix signal hookup and disable main-window timing flag. Replace the second connection of multi_camera_controller.frame_ready to _on_multi_frame_display_ready with multi_camera_controller.display_ready to separate processing-ready and display-ready events. Also comment out MAIN_WINDOW_DO_LOG_TIMING in config.py to disable main-window timing logging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

camera Related to cameras and camera backends enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants